
<?php
use app\backend\widgets\LinkPager;
use app\backend\components\AppAdminAcl;
use yii\helpers\Url;
$this->title = '用户管理';
$this->params['breadcrumbs'] = [['label' => '用户']];
?>
<h3 class="page-title fl"> 用户管理
    <small></small>
</h3>
<div calss="clear"></div>
<div class="row">
    <div class="col-md-12 fl">
    <a href="<?php echo Url::to(['/user/userinfo/add']); ?>" class="btn btn-success btn-lg" style="border-radius:5px !important;background-color:#2ECC71">+添加用户</a>
    </div>
    <div class="col-md-12" style="margin-top:10px">
            <div class="portlet-body">
                    <table id="ta"
                           class="table table-striped  table-hover table-checkable order-column">
                        <thead>
                        <tr class="row" style="background-color:#eee;">
                            <th class="col-md-2" style="text-align:center;"> <div> 用户名称 </div> </th>
                            <th class="col-md-3" style="text-align:center;"> <div> 入职日期 </div> </th>
                            <th class="col-md-3" style="text-align:center;"> <div> 离职日期 </div> </th>
                            <th class="col-md-4" style="text-align:center;"> <div> 操作 </div> </th>
                        </tr>
                        </thead>
                        <tbody> 
                        <?php foreach($user as $v): ?>            
                            <tr class="row userleave" style="cursor:pointer">
                                <td style="text-align:center;"><div><?= $v['name'] ?></div> </td>
                                <td style="text-align:center;"> <div><?= date('Y-m-d h:i:s',$v['start_time']) ?></div> </td>
                                <td style="text-align:center;"> <div class="sureleave"><?= $v['finish_time'] == 0?'在职':date('Y-m-d h:i:s',$v['finish_time']) ?></div> </td>
                                <td style="text-align:center;"> <div><button class="btn btn-primary btn-sm user_detail" data-id="<?= $v['user_id'] ?>">查看详情</button>
                                <a href="<?php echo Url::to(['/user/userinfo/update','user_id'=>$v['user_id']]) ?>" class="btn btn-success btn-sm">编辑</a>
								<?php if($v['disabled'] == 0): ?>
                                <button class="btn btn-danger btn-sm leave" data-id="<?= $v['user_id'] ?>">办理离职</button><?php endif; ?>
                                </div> </td>
                            </tr>
                        <?php endforeach; ?>
                        </tbody>
                    </table>
            </div>
            <div>
				<?php
                echo LinkPager::widget([
                    'pagination' => $pages,
                    'firstPageLabel' => "首页",
                    'prevPageLabel' => '上一页',
                    'nextPageLabel' => '下一页',
                    'lastPageLabel' => '末页',
                ]);
                ?>
            </div>
    </div>
</div>
<script>

</script>